<?php
/**
 * Created by PhpStorm.
 * User: dumbledore
 * Date: 2018/3/19
 * Time: 上午10:17
 */
?>
<!DOCTYPE html>
<html>
<head>
    <!--[if lt IE 7]>
    <div class="ie6_error">还在用<strong>漏洞百出的IE6浏览器</strong>么？为了您的网络安全，请升级浏览器 <a target="_blank"
                                                                               href="http://browsehappy.com">立即升级</a>
    </div>
    <![endif]-->

    <meta charset="utf-8">
    <title>申请账期用户-文具1号</title>
    <meta name="description"
          content="文具1号作为上海办公用品供货商公司,专为世界500强企业及SOHO办公族提供网上商城一站式办公耗材批发及采购服务,一站式选购办公日用文具用品,厂家直销,好货又便宜【阳光采购就上文具1号 阳光价格 老板放心 品质保障 员工省力】"/>
    <meta name="keywords" content="办公用品,办公文具,办公文具网站,文具网站,办公用品网,文具采购网,金万年"/>
    <meta name="copyright" content="上海易推信息科技有限公司"/>
    <meta name="renderer" content="webkit">
    <base href="<?php echo base_url(); ?>"/>
    <link rel="shortcut icon" href="favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="public/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="public/css/common.css"/>
    <link rel="stylesheet" href="public/js/layui/css/layui.css">
    <link href="public/css/city-picker.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="public/css/index.css"/>
    <!--[if lte IE 9]>
    <script type="text/javascript" src="public/js/html5shiv-printshiv-3.js"></script>
    <![endif]-->
</head>
<body>
<div class="bg bg-fff">
    <!--common - head -->
    <div class="header">
        <?php $this->load->view('common/header.php'); ?>
        <div class="top-banner">
            <div class="top-banner-container">
                <p class="p01">申请账期用户</p>
                <p class="p02">资金按月计算，利用额度和账期便捷支付，成为优质买家</p>
            </div>
        </div>
        <div class="step-box">
            <div class="step-box-container">
                <span class="name">申请审核流程：</span>
                <span class="step-box-item step-box-item0 step-box-item_h step-box-item-click"
                      data-index="0">企业信息</span>
                <span class="step-line"></span>
                <span class="step-box-item step-box-item1" data-index="1">法律代表人信息</span>
                <span class="step-line"></span>
                <span class="step-box-item step-box-item2" data-index="2">采购信息</span>
                <span class="step-line"></span>
                <span class="step-box-item step-box-item3" data-index="3">增票资质</span>
            </div>
        </div>
    </div>
    <!--common - head end-->

    <div class="container">
        <div class="container-main">
            <p class="service-notice">服务须知：账期支付目前仅针对企业用户，审核资料通过后我们会安排您的专属客户经理与您取得联系。如有疑问，请拨打企业专享热线：4008-215-248或联系
                <a href="http://care3.live800.com/live800/chatClient/chatbox.jsp?companyID=80000026&configID=2473"
                   target="_blank">在线客服</a>
            </p>

            <div class="apply-payment-form-wrapper">

                <form class="layui-form apply-payment-form" method="post">
                    <div class="apply-payment-box apply-payment-box-qy">

                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">1</span>企业名称 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="text" name="name" id="name" required placeholder="请输入工商执照上的企业名称"
                                       autocomplete="off"
                                       lay-verify="required" class="apply-payment-input layui-input">
                            </div>
                        </div><!--企业名称-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">2</span>企业所在地 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <div class="apply-payment-city-box">
                                    <div id="distpicker1">
                                        <div class="form-group">
                                            <div style="position: relative;">
                                                <input id="city-picker1" class="form-control" readonly type="text"
                                                       value="请选择省/市/区" data-toggle="city-picker">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <input type="text" name="address" id="address" required placeholder="请输入详细地址"
                                       autocomplete="off" lay-verify="required" class="apply-payment-input layui-input">
                            </div>
                        </div><!--企业所在地-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">3</span>营业执照 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <div class="apply-payment-file-box">
                                    <div class="layui-upload input-business-license bg-icon_addphoto_n">
                                        <button type="button" class="layui-btn" id="test1">上传图片</button>
                                        <div class="layui-upload-list">
                                            <img class="layui-upload-img" id="demo1" src="">
                                            <!--<p id="demoText"></p>-->
                                        </div>
                                    </div>
                                </div>
                                <p class="apply-payment-file-p">请上传原件彩色照片；图片尺寸最大不超过5M</p>
                            </div>
                        </div><!--上传营业执照-->

                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">4</span>营业执照注册号 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block apply-payment-radio-box">
                                <input type="radio" name="sex" id="shtyxydm" value="统一社会信用代码" title="统一社会信用代码" checked>
                                <input type="radio" name="sex" id="yyzzzch" value="营业执照注册号" title="营业执照注册号">
                            </div>
                            <div class="layui-input-block">
                                <input type="text" id="change_yyzz_id" required name="credit_code"
                                       placeholder="请输入统一社会信用代码" autocomplete="off"
                                       class="apply-payment-input layui-input" value="">
                            </div>
                        </div><!--营业执照注册号-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">5</span>企业性质 <em class="color-red">*</em></p>
                            <div class="layui-input-block apply-payment-row">
                                <select name="type" lay-filter="qyxz" lay-verify="required">
                                    <option value="">请选择企业性质</option>
                                    <option value="1">政府机关、事业单位</option>
                                    <option value="2" selected="">国营</option>
                                    <option value="3">私营</option>
                                    <option value="4">合资</option>
                                    <option value="5">外资</option>
                                    <option value="6">其他</option>

                                </select>
                            </div>
                        </div><!--企业性质-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">6</span>企业人数 <em class="color-red">*</em></p>
                            <div class="layui-input-block apply-payment-row">
                                <select name="number" lay-filter="qyxz" lay-verify="required">
                                    <option value="">请选择企业人数</option>
                                    <option value="1">1-49</option>
                                    <option value="2" selected="">50-99</option>
                                    <option value="3">100-499</option>
                                    <option value="4">500-999</option>
                                    <option value="5">1000以上</option>
                                </select>
                            </div>
                        </div><!--企业人数-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">7</span>所属行业 <em class="color-red">*</em></p>
                            <div class="layui-input-block apply-payment-row">
                                <select name="industry" lay-filter="qyxz" lay-verify="required">
                                    <option value="">请选择行业</option>
                                    <option value="1" selected="">IT、互联网、科技</option>
                                    <option value="2">金融、证券、保险</option>
                                    <option value="3">房地产、建筑、工程</option>
                                    <option value="4">广告、创意、设计</option>
                                    <option value="5">教育、文化、艺术</option>
                                    <option value="6">其他</option>
                                </select>
                            </div>
                        </div><!--所属行业-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">8</span>办公电话 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="text" name="phone" required lay-verify="required"
                                       id="phone" placeholder="包括区号、电话、分机号，以“-”隔开"
                                       autocomplete="off" class="apply-payment-input layui-input">
                            </div>
                        </div><!--企业名称-->


                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <a class="layui-btn btn-next btn-next-step" data-index="1" href="javascript:;">下一步</a>
                            </div>
                        </div>
                    </div>   <!--企业信息-->

                    <div class="apply-payment-box apply-payment-box-frdb none">

                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">1</span>合同签订人 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <input type="text" name="contractor" lay-verify="required" required
                                       id="contractor" placeholder="请输入真实姓名" autocomplete="off"
                                       class="apply-payment-input layui-input">
                            </div>
                        </div><!--企业名称-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">2</span>合同签订人电子邮箱 <em
                                        class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="email" name="email" required lay-verify="email" placeholder="请输入电子邮箱 "
                                       id="email" autocomplete="off" class="apply-payment-input layui-input">
                            </div>
                        </div><!--合同签订人电子邮箱-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">3</span>联系人手机 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <input type="tel" name="tel" id="tel" maxlength="11" required
                                       lay-verify="required|phone" placeholder="请输入联系人手机 " autocomplete="off"
                                       class="apply-payment-input layui-input">
                            </div>
                        </div><!--联系人手机-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">4</span>短信验证码 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <input type="tel" name="code" required lay-verify="code" placeholder="请输入6位数验证码 "
                                       id="code" autocomplete="off" class="apply-payment-input layui-input">
                                <!--<a href="javascript:;" class="send-code">发送验证码</a>-->
                                <a href="javascript:;" class="send-code" style="height: 10px;">
                                    <input type="button" onclick="sendCode(this)" value="点击发送验证码"/>
                                </a>
                            </div>
                        </div><!--联系人手机-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">5</span>身份证号码 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <input type="text" name="id_card_no" required lay-verify="identity"
                                       id="id_card_no" placeholder="请输入二代身份证号码 " autocomplete="off"
                                       class="apply-payment-input layui-input">
                            </div>
                        </div><!--身份证号码-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">6</span>上传法人身份证照片 <em
                                        class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <div class="apply-payment-file-box">
                                    <div class="layui-upload input-business-license bg-icon_addphoto_n">
                                        <button type="button" class="layui-btn" id="test2">上传图片</button>
                                        <div class="layui-upload-list">
                                            <img class="layui-upload-img" id="demo2">
                                            <!--<p id="demoText"></p>-->
                                        </div>
                                    </div>
                                </div>
                                <div class="apply-payment-file-box">
                                    <div class="layui-upload input-business-license bg-icon_addphoto_n">
                                        <button type="button" class="layui-btn" id="test3">上传图片</button>
                                        <div class="layui-upload-list">
                                            <img class="layui-upload-img" id="demo3">
                                            <!--<p id="demoText"></p>-->
                                        </div>
                                    </div>
                                </div>
                                <p class="apply-payment-file-p">请上传原件彩色照片；图片尺寸最大不超过5M</p>
                            </div>
                        </div><!--上传法人身份证照片-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">7</span>注册邀请人手机号
                            </p>
                            <div class="layui-input-block">
                                <input type="tel" name="inviter_tel" maxlength="11" required
                                       id="inviter_tel" placeholder="请输入邀请人手机号 " autocomplete="off"
                                       class="apply-payment-input layui-input">
                            </div>
                        </div><!--注册邀请人手机号-->

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <a class="layui-btn btn-next btn-next-step" data-index="0" href="javascript:;">上一步</a>
                                <a class="layui-btn btn-next btn-next-step" data-index="2" href="javascript:;">下一步</a>
                            </div>
                        </div>

                    </div> <!--法律代表人信息-->

                    <div class="apply-payment-box apply-payment-box-cg none">

                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">1</span>每月最低采购金额 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <input type="text" name="minimum_purchase_amount" required placeholder="请输入金额"
                                       id="minimum_purchase_amount" lay-verify="number|positive" autocomplete="off"
                                       class="apply-payment-input layui-input">
                                <span class="apply-payment-input-unit">元</span>
                            </div>
                        </div>
                        <!--每月最低采购金额-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">2</span>收货地 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <div class="apply-payment-city-box">
                                    <div id="distpicker2">
                                        <div class="form-group">
                                            <div style="position: relative;">
                                                <input id="city-picker2" class="form-control" readonly type="text"
                                                       value="请选择省/市/区" data-toggle="city-picker">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <input type="text" name="shipping_address" required placeholder="请输入详细地址"
                                       id="shipping_address" autocomplete="off" class="apply-payment-input layui-input">
                            </div>
                        </div><!--企业所在地-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">3</span>收货人姓名 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <input type="text" name="shipping_name" required placeholder="请输入收货人姓名"
                                       id="shipping_name" lay-verify="required"
                                       autocomplete="off" class="apply-payment-input layui-input">
                            </div>
                        </div><!--收货人姓名-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">4</span>联系电话 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="tel" name="shipping_tel" maxlength="11" required
                                       id="shipping_tel" lay-verify="required|phone" placeholder="请输入手机号 "
                                       autocomplete="off"
                                       class="apply-payment-input layui-input">
                            </div>
                        </div><!--联系电话-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">5</span>第二收货人姓名 </p>
                            <div class="layui-input-block">
                                <input type="text" name="shipping_name_second" placeholder="请输入收货人姓名"
                                       id="shipping_name_second" autocomplete="off"
                                       class="apply-payment-input layui-input">
                            </div>
                        </div><!--第二收货人姓名-->
                        <div class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">6</span>第二收货人联系电话</p>
                            <div class="layui-input-block">
                                <input type="tel" name="shipping_tel_second" maxlength="11"
                                       id="shipping_tel_second" lay-verify="nullphone" placeholder="请输入手机号 "
                                       autocomplete="off"
                                       class="apply-payment-input layui-input">
                            </div>
                        </div><!--第二收货人联系电话-->

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <a class="layui-btn btn-next btn-next-step" data-index="1" href="javascript:;">上一步</a>
                                <a class="layui-btn btn-next btn-next-step" data-index="3" href="javascript:;">下一步</a>
                            </div>
                        </div>

                    </div>   <!--采购信息-->
                    <div class="apply-payment-box apply-payment-box-zpzz none">

                        <div class="layui-form-item">
                            <div class="layui-input-block apply-payment-radio-wrapper">
                                <span class="apply-payment-radio-num">1</span>
                                <div class="apply-payment-radio-row">
                                    <input type="radio" name="mark_invoice_type" title="逐月开票" value="1" checked>
                                </div>
                                <p class="apply-payment-radio-text">即乙方在每月固定日将双方于上一个对账周期发生的交易账单明细及与账单总额相应的发票送达给甲方。</p>
                                <div class="apply-payment-radio-row">
                                    <input type="radio" name="mark_invoice_type" title="逐次开票" value="2">
                                </div>
                                <p class="apply-payment-radio-text">即乙方每次送货至甲方时，同时送达该次送货所对应的货物发票，若发生退换货，则相应地调整发票内容。</p>
                            </div>
                        </div><!--单位名称-->
                        <div class="layui-form-item">
                            <div class="layui-input-block apply-payment-radio-wrapper mb35">
                                <span class="apply-payment-radio-num">2</span>
                                <input type="radio" name="invoice_type" id="zzs_id" title="增值税专用发票" value="1" checked>
                                <input type="radio" name="invoice_type" id="zzspt_id" title="增值税普通发票" value="2">
                                <input type="radio" name="invoice_type" id="wfp_id" title="无需发票" value="3">
                            </div>
                        </div><!--单位名称-->
                        <div id="dwmc_div" class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">3</span>单位名称 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="text" name="invoice_company_name" placeholder="请输入单位名称" autocomplete="off"
                                       id="invoice_company_name" class="apply-payment-input layui-input">
                            </div>
                        </div><!--单位名称-->
                        <div id="nsrsbm_div" class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">4</span>纳税人识别码 <em class="color-red">*</em>
                            </p>
                            <div class="layui-input-block">
                                <input type="text" name="invoice_code" placeholder="请输入纳税人识别码" autocomplete="off"
                                       id="invoice_code" class="apply-payment-input layui-input">
                            </div>
                        </div><!--纳税人识别码-->
                        <div id="zcdz_div" class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">5</span>注册地址 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="text" name="invoice_address" placeholder="请输入开票地址" autocomplete="off"
                                       id="invoice_address" class="apply-payment-input layui-input">
                            </div>
                        </div><!--注册地址-->
                        <div id="zcdh_div" class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">6</span>注册电话 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="text" name="invoice_tel" placeholder="请输入开票电话" autocomplete="off"
                                       id="invoice_tel" class="apply-payment-input layui-input">
                            </div>
                        </div><!--注册电话*-->
                        <div id="khyh_div" class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">7</span>开户银行 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="text" name="invoice_bank" placeholder="请输入银行名称" autocomplete="off"
                                       id="invoice_bank" class="apply-payment-input layui-input">
                            </div>
                        </div><!--开户银行-->
                        <div id="yhzh_div" class="layui-form-item">
                            <p class="apply-payment-tit"><span class="num">8</span>银行账户 <em class="color-red">*</em></p>
                            <div class="layui-input-block">
                                <input type="text" name="invoice_account" placeholder="请输入银行账户" autocomplete="off"
                                       id="invoice_account" class="apply-payment-input layui-input" value="">
                            </div>
                        </div><!--银行账户-->

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <a class="layui-btn btn-next btn-next-step" data-index="2" href="javascript:;">上一步</a>
                                <button class="layui-btn btn-next" onclick="change_param()" id="submit-form" lay-submit
                                        lay-filter="*">提
                                    交
                                </button>
                                <p class="apply-payment-rule">
                                    <input class="apply-payment-rule-checkbox" type="checkbox" id="agree"
                                           name="like1[write]" lay-skin="primary" title="" checked="">我已阅读并同意 <a
                                            href="http://www.wjyh.com/mMRegister-agreement.html"
                                            target="_blank">《服务协议》</a>
                                </p>
                            </div>
                        </div>

                        <!--同意条款-->


                    </div> <!--增票资质-->


                    <div style="display: none">
                        <input type="hidden" name="business_license_pic_path" id="business_license_pic_path" value="">
                        <input type="hidden" name="id_card_front_pic_path" id="id_card_front_pic_path" value="">
                        <input type="hidden" name="id_card_back_pic_path" id="id_card_back_pic_path" value="">

                        <input type="hidden" name="province" id="province" value="">
                        <input type="hidden" name="city" id="city" value="">
                        <input type="hidden" name="district" id="district" value="">

                        <input type="hidden" name="shipping_province" id="shipping_province" value="">
                        <input type="hidden" name="shipping_city" id="shipping_city" value="">
                        <input type="hidden" name="shipping_district" id="shipping_district" value="">
                    </div>
                </form>

            </div>
        </div>

    </div>

    <?php $this->load->view('common/bottom.php'); ?>
</div>
<script type="text/javascript" src="public/js/jquery.min.js"></script>
<script src="public/js/layui/layui.js"></script>
<script src="public/js/city-picker.data.js"></script>
<script src="public/js/city-picker.js"></script>
<script type="text/javascript" src="public/js/index.js"></script>
<script>
    layui.use(['apply_form', 'layedit', 'laydate', 'upload'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit;
        var $ = layui.jquery
            , upload = layui.upload;

        form.verify({
            nullphone: function (value, item) { //value：表单的值、item：表单的DOM对象
                if (!value) {
                } else {
                    if (!(/^[1][3,4,5,7,8][0-9]{9}$/.test(value))) {
                        return '请输入正确的手机号';
                    }
                }
            },
            positive: function (value, item) {
                if (value < 0) {
                    return '必选大于0';
                }
            }


        });

        //普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            , url: 'upload/upload_image'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.code < 0) {
                    $("#business_license_pic_path").val('');
                    $('#demo1').attr('src', '')
                    return layer.msg('上传失败');
                } else {
                    $("#business_license_pic_path").val(res.data.file_name);
                    $('#demo1').attr('src', "<?php echo $this->config->item('upload_url');?>" + res.data.file_name);
                    return layer.msg('上传成功');
                }
                //上传成功
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
        var uploadInst2 = upload.render({
            elem: '#test2'
            , url: 'upload/upload_image'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo2').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.code < 0) {
                    $("#id_card_front_pic_path").val('');
                    $('#demo2').attr('src', '')
                    return layer.msg('上传失败');
                } else {
                    $("#id_card_front_pic_path").val(res.data.file_name);
                    $('#demo2').attr('src', "<?php echo $this->config->item('upload_url');?>" + res.data.file_name);
                    return layer.msg('上传成功');
                }
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
        var uploadInst3 = upload.render({
            elem: '#test3'
            , url: 'upload/upload_image'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo3').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.code < 0) {
                    $("#id_card_back_pic_path").val('');
                    $('#demo3').attr('src', '')
                    return layer.msg('上传失败');
                } else {
                    $("#id_card_back_pic_path").val(res.data.file_name);
                    $('#demo3').attr('src', "<?php echo $this->config->item('upload_url');?>" + res.data.file_name);
                    return layer.msg('上传成功');
                }
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });

        //监听提交
        form.on('submit(*)', function (data) {
            console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
            console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
            console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
            $.ajax({
                type: "post",
                dataType: "json",
                url: "customer/admin_apply_for_period_user",
                data: data.field,
                jsonp: 'callback',
                async: false,
                success: function (data) {
                    if (data.code == 0) {
                        layer.msg("保存成功");
                        window.location.href = "index";
                    } else {
                        if (data.msg == '验证码错误') {
                            $('.apply-payment-box').hide();
                            $('.apply-payment-box-frdb').show();
                            var index = $('.step-box-item1').attr('data-index');
                            $('.step-box-item').removeClass('step-box-item_h');
                            $('.step-box-item' + index).addClass('step-box-item_h');
                            var a = $('#code').offset().top;
                            $("html,body").animate({scrollTop: a}, 'slow');
                        }
                        layer.msg(data.msg)
                    }
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        $('#shtyxydm').next().click(function () {
            $("#change_yyzz_id").attr('placeholder', '请输入统一社会信用代码');
            $("#change_yyzz_id").attr('name', 'credit_code');
        });

        $('#yyzzzch').next().click(function () {
            $("#change_yyzz_id").attr('placeholder', '请输入营业执照注册号');
            $("#change_yyzz_id").attr('name', 'business_license_number');
        });

        $('#zzs_id').next().click(function () {
            $("#dwmc_div").show();
            $("#nsrsbm_div").show();
            $("#zcdz_div").show();
            $("#zcdh_div").show();
            $("#khyh_div").show();
            $("#yhzh_div").show();
        });

        $('#zzspt_id').next().click(function () {
            $("#dwmc_div").show();
            $("#nsrsbm_div").show();
            $("#zcdz_div").hide();
            $("#zcdh_div").hide();
            $("#khyh_div").hide();
            $("#yhzh_div").hide();
        });

        $('#wfp_id').next().click(function () {
            $("#dwmc_div").hide();
            $("#nsrsbm_div").hide();
            $("#zcdz_div").hide();
            $("#zcdh_div").hide();
            $("#khyh_div").hide();
            $("#yhzh_div").hide();
        });


    });
</script>

<script type="text/javascript">
    $(function () {
        $("#city-picker1").citypicker();
        $("#city-picker2").citypicker();
        $(".btn-next-step").click(function (e) {
            var data = $(this).attr('data-index');
            if (data == 1) {
                if (!$('#name').val()) {
                    var a = $('.layui-form-item').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('企业名称必须填写');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg=/^[A-Za-z0-9\_\-\(\)（）\u4e00-\u9fa5]+$/;//中文，英文和数字
                    var name = $('#name').val();
                    if (!/^[A-Za-z0-9\_\-\(\)（）\u4e00-\u9fa5]+$/.test(name)) {
                        var a = $('#name').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('企业名称请输入中英文，数字,"-","_","（）","()"的组合');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(name).length < 4 || $.trim(name).length > 40) {
                        var a = $('.layui-form-item').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('企业名称请输入4-40个字符');
                        e.stopPropagation();
                        return false;
                    }
                }
                if (!$('#city-picker1').val()) {
                    var a = $('#distpicker1 .city-picker-span').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('企业所在地必须选择');
                    e.stopPropagation();
                    return false;
                }
                if (!$('#address').val()) {
                    var a = $('#distpicker1 .city-picker-span').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('企业详细地址必须填写');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg=/^(?=.*?[\u4E00-\u9FA5])/;
                    var address = $('#address').val();
                    if (!/^(?=.*?[\u4E00-\u9FA5])/.test(address)) {
                        var a = $('#distpicker1 .city-picker-span').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('企业详细地址不能全为数字或字母');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(address).length < 6 || $.trim(address).length > 60) {
                        var a = $('#distpicker1 .city-picker-span').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('企业详细地址必须为6-60个字符');
                        e.stopPropagation();
                        return false;
                    }
                }

                if (!$('#demo1').attr('src')) {
                    var a = $('#demo1').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('营业执照必须上传');
                    e.stopPropagation();
                    return false;
                }
                if (!$('#change_yyzz_id').val()) {
                    var a = $('#change_yyzz_id').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    if ($('#change_yyzz_id').attr('placeholder') == '请输入统一社会信用代码') {
                        layer.msg('统一社会信用代码必须填写');
                    } else {
                        layer.msg('营业执照注册号必须填写');
                    }
                    e.stopPropagation();
                    return false;
                } else {
                    var tmptxt = $('#change_yyzz_id').val();
                    // var  reg=/^[0-9]*$/;
                    if (!/^[A-Za-z0-9]+$/.test(tmptxt)) {
                        var a = $('#change_yyzz_id').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        if ($('#change_yyzz_id').attr('placeholder') == '请输入统一社会信用代码') {
                            layer.msg('统一社会信用代码只能是数字和字母的组合');
                        } else {
                            layer.msg('营业执照注册号,只能是数字和字母的组合');
                        }
                        e.stopPropagation();
                        return false;
                    }
                    var tmptxtlength = tmptxt.length;
                    if (tmptxtlength !== 15 && tmptxtlength !== 18) {
                        var a = $('#change_yyzz_id').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('格式输入错误，请核对！');
                        e.stopPropagation();
                        return false;
                    }
                }

                if (!$('#phone').val()) {
                    var a = $('#phone').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('办公电话必须填写');
                    e.stopPropagation();
                    return false;
                } else {
                    var tel = $('#phone').val();
                    var phone = tel.length;
                    if (!/^0\d{2,3}-?\d{7,8}(-\d{1,8})?$/.test(tel)) {
                        if (!/^1[345789]{1}\d{9}$/.test(tel)) {
                            var a = $('#phone').offset().top;
                            $("html,body").animate({scrollTop: a}, 'slow');
                            layer.msg('办公电话格式输入错误，请核对');
                            return false;
                        }
                    }
                    // if(phone < 11 || phone > 20){
                    //     var a = $('#phone').offset().top;
                    //     $("html,body").animate({scrollTop: a}, 'slow');
                    //     layer.msg('办公电话请输入11-20位字符');
                    //     return false;
                    // }
                }
            }
            if (data == 2) {
                if (!$('#contractor').val()) {
                    var a = $('#contractor').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('合同签订人姓名必须填写');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg=/^[\u4e00-\u9fa5]+$/;
                    var contractor = $('#contractor').val();
                    if (!/^[\u4e00-\u9fa5]+$/.test(contractor)) {
                        var a = $('#contractor').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('请输入中文');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(contractor).length < 2 || $.trim(contractor).length > 20) {
                        var a = $('#contractor').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('合同签订人姓名必须为2-20个字符');
                        e.stopPropagation();
                        return false;
                    }
                }

                if (!$('#email').val()) {
                    var a = $('#email').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('合同签订人邮箱必须填写');
                    e.stopPropagation();
                    return false;
                } else {
                    var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
                    var email = $('#email').val();
                    if (!reg.test(email)) {
                        var a = $('#email').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('E-mail地址不规范，请重新填写');
                        return false;
                    }
                }

                if (!$('#tel').val()) {
                    var a = $('#tel').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('联系人手机必须填写');
                    e.stopPropagation();
                    return false;
                } else {
                    /*var phone_reg = /^1[345789]{1}\d{9}$/;*/
                    var new_tel = $('#tel').val();
                    if (!/^1[345789]{1}\d{9}$/.test(new_tel)) {
                        var a = $('#tel').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('手机号不规范，请重填');
                        return false;
                    }
                }

                if (!$('#code').val()) {
                    var a = $('#code').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入验证码');
                    e.stopPropagation();
                    return false;
                } else {
                    var code = $('#code').val();
                    var codelength = $.trim(code).length;
                    if (codelength !== 6) {
                        var a = $('#code').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('请输入6位验证码');
                        e.stopPropagation();
                        return false;
                    }
                }
                if (!$('#id_card_no').val()) {
                    var a = $('#id_card_no').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入二代身份证号码');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg = /(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/;
                    // var reg = /^(\d{15}$)|(^\d{17}([0-9]|X))$/isu;
                    var card = $('#id_card_no').val();
                    if (!/(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/.test(card)) {
                        var a = $('#id_card_no').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('无效的身份证号');
                        e.stopPropagation();
                        return false;
                    }
                    function IdentityCodeValid(code) {
                        var city = {
                            11: "北京",
                            12: "天津",
                            13: "河北",
                            14: "山西",
                            15: "内蒙古",
                            21: "辽宁",
                            22: "吉林",
                            23: "黑龙江 ",
                            31: "上海",
                            32: "江苏",
                            33: "浙江",
                            34: "安徽",
                            35: "福建",
                            36: "江西",
                            37: "山东",
                            41: "河南",
                            42: "湖北 ",
                            43: "湖南",
                            44: "广东",
                            45: "广西",
                            46: "海南",
                            50: "重庆",
                            51: "四川",
                            52: "贵州",
                            53: "云南",
                            54: "西藏 ",
                            61: "陕西",
                            62: "甘肃",
                            63: "青海",
                            64: "宁夏",
                            65: "新疆",
                            71: "台湾",
                            81: "香港",
                            82: "澳门",
                            91: "国外 "
                        };
                        var tip = "";
                        var pass = true;
                        if (!code || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(code)) {
                            tip = "身份证号格式错误";
                            pass = false;
                        }

                        else if (!city[code.substr(0, 2)]) {
                            tip = "地址编码错误";
                            pass = false;
                        }
                        else {
                            //18位身份证需要验证最后一位校验位
                            if (code.length == 18) {
                                code = code.split('');
                                //∑(ai×Wi)(mod 11)
                                //加权因子
                                var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
                                //校验位
                                var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
                                var sum = 0;
                                var ai = 0;
                                var wi = 0;
                                for (var i = 0; i < 17; i++) {
                                    ai = code[i];
                                    wi = factor[i];
                                    sum += ai * wi;
                                }
                                var last = parity[sum % 11];
                                if (parity[sum % 11] != code[17]) {
                                    tip = "校验位错误";
                                    pass = false;
                                }
                            }
                        }
                        return pass;
                    }

                    if (!IdentityCodeValid(card)) {
                        var a = $('#id_card_no').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('无效的身份证号');
                        e.stopPropagation();
                        return false;
                    }
                }
                if (!$('#demo2').attr('src')) {
                    var a = $('#demo2').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('法人身份证照片必须上传');
                    e.stopPropagation();
                    return false;
                }
                if (!$('#demo3').attr('src')) {
                    var a = $('#demo3').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('法人身份证照片必须上传');
                    e.stopPropagation();
                    return false;
                }

                if ($('#inviter_tel').val()) {
                    // var phone_reg = /^1[345789]{1}\d{9}$/;
                    var new_tel = $('#inviter_tel').val();
                    if (!/^1[345789]{1}\d{9}$/.test(new_tel)) {
                        var a = $('#inviter_tel').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('邀请人手机号不规范，请重填');
                        return false;
                    }
                }
            }
            if (data == 3) {
                if (!$('#minimum_purchase_amount').val()) {
                    var a = $('#minimum_purchase_amount').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入最低采购金额');
                    e.stopPropagation();
                    return false;
                } else {
                    var tmptxt = $('#minimum_purchase_amount').val();
                    // var reg = ;/^[1-9][0-9]*$/
                    if (!/^[1-9]\d*(\.\d+)?$/.test(tmptxt)) {
                        var a = $('#minimum_purchase_amount').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('最低采购金额必须大于零');
                        e.stopPropagation();
                        return false;
                    }
                }
                if (!$('#city-picker2').val()) {
                    var a = $('#distpicker2 .city-picker-span').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('收货地址必须选择');
                    e.stopPropagation();
                    return false;
                }
                if (!$('#shipping_address').val()) {
                    var a = $('#shipping_address').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('收货详细地址必须填写');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg = /^(?=.*?[\u4E00-\u9FA5])/;
                    var shipping_address = $('#shipping_address').val();
                    if (!/^(?=.*?[\u4E00-\u9FA5])/.test(shipping_address)) {
                        var a = $('#distpicker2 .city-picker-span').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('收货地址不能全为数字和字母');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(shipping_address).length < 6 || $.trim(shipping_address).length > 60) {
                        var a = $('#distpicker2 .city-picker-span').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('收货地址必须为6-60个字符');
                        e.stopPropagation();
                        return false;
                    }
                }
                if (!$('#shipping_name').val()) {
                    var a = $('#shipping_name').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入收货人姓名');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg = /^[\u4e00-\u9fa5]+$/;
                    var shipping_name = $('#shipping_name').val();
                    if (!/^[\u4e00-\u9fa5]+$/.test(shipping_name)) {
                        var a = $('#shipping_name').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('收货人姓名，请输入中文');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(shipping_name).length < 2 || $.trim(shipping_name).length > 20) {
                        var a = $('#shipping_name').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('收货人必须为2-20个字符');
                        e.stopPropagation();
                        return false;
                    }
                }


                if (!$('#shipping_tel').val()) {
                    var a = $('#shipping_tel').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入收货人联系电话');
                    e.stopPropagation();
                    return false;
                } else {
                    var shooping_tel = $('#shipping_tel').val();
                    /*  var mobile = /^1[345789]{1}\d{9}$/;*/
                    if (!/^1[345789]{1}\d{9}$/.test(shooping_tel)) {
                        var a = $('#shipping_tel').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('收货人联系电话有误，请重填');
                        e.stopPropagation();
                        return false;
                    }
                }
                if ($('#shipping_name_second').val()) {

                    // var reg=/^[\u4e00-\u9fa5]+$/;
                    var shipping_name = $('#shipping_name_second').val();
                    if (!/^[\u4e00-\u9fa5]+$/.test(shipping_name)) {
                        var a = $('#shipping_name_second').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('第二收货人姓名，请输入中文');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(shipping_name).length < 2 || $.trim(shipping_name).length > 20) {
                        var a = $('#shipping_name_second').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('第二收货人必须为2-20个字符');
                        e.stopPropagation();
                        return false;
                    }
                }
                if ($('#shipping_tel_second').val()) {
                    var shooping_tel = $('#shipping_tel_second').val();
                    // var mobile = /^[1][3,4,5,7,8][0-9]{9}$/;
                    // var mobile = /^1[345789]{1}\d{9}$/;
                    if (!/^1[345789]{1}\d{9}$/.test(shooping_tel)) {
                        var a = $('#shipping_tel_second').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('第二收货人联系电话有误，请重填');
                        e.stopPropagation();
                        return false;
                    }
                }
            }
            var index = $(this).attr('data-index');
            $('.step-box-item').removeClass('step-box-item_h');
            $('.step-box-item' + index).addClass('step-box-item-click step-box-item_h');
            var as = $('.step-box-item').offset().top;
            $("html,body").animate({scrollTop: as}, 'normal');
            $('.apply-payment-box ').eq(index).show().siblings().hide();
        });


        $(".step-box-container").delegate(".step-box-item-click", "click", function () {
            var index = $(this).attr('data-index');
            $('.apply-payment-box ').eq(index).show().siblings().hide();
            $('.step-box-item').removeClass('step-box-item_h');
            $('.step-box-item' + index).addClass('step-box-item_h');
        });
        $("#submit-form").click(function (e) {
            if (!$('#agree').is(':checked')) {
                layer.msg('请先阅读并同意协议');
                e.stopPropagation();
                return false;
            }
            // if (typeof($("#distpicker1 [data-count='district']").attr('data-code')) == 'undefined') {
            //     $('.apply-payment-box').hide();
            //     $('.apply-payment-box-qy').show();
            //     var a = $('#distpicker1 .city-picker-span').offset().top;
            //     $("html,body").animate({scrollTop: a}, 'slow');
            //     layer.msg('企业所在地必须选择');
            //     e.stopPropagation();
            //     return false;
            // }
            // if (typeof($("#distpicker2 [data-count='district']").attr('data-code')) == 'undefined') {
            //     $('.apply-payment-box').hide();
            //     $('.apply-payment-box-cg').show();
            //     var a = $('#distpicker2 .city-picker-span').offset().top;
            //     $("html,body").animate({scrollTop: a}, 'slow');
            //     layer.msg('收货地必须选择');
            //     e.stopPropagation();
            //     return false;
            // }
            $("#province").val($("#distpicker1 [data-count='province']").html());
            $("#city").val($("#distpicker1 [data-count='city']").html());
            $("#district").val($("#distpicker1 [data-count='district']").html());
            $("#shipping_province").val($("#distpicker2 [data-count='province']").html());
            $("#shipping_city").val($("#distpicker2 [data-count='city']").html());
            $("#shipping_district").val($("#distpicker2 [data-count='district']").html());

            if ($('#zzs_id').is(':checked')) {
                if (!$('#invoice_company_name').val()) {
                    var a = $('#invoice_company_name').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入单位名称');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg = /^[A-Za-z0-9\_\-\(\)（）\u4e00-\u9fa5]+$/;//中文，英文和数字
                    var name = $('#invoice_company_name').val();
                    var company_name = $.trim(name).length;
                    if (!/^[A-Za-z0-9\_\-\(\)（）\u4e00-\u9fa5]+$/.test(name)) {
                        var a = $('#invoice_company_name').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('单位名称请输入中英文，数字,"-","_","（）","()"的组合');
                        e.stopPropagation();
                        return false;
                    }
                    if (company_name < 3 || company_name > 60) {
                        var a = $('#invoice_company_name').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('单位名称请输入3-60个字符');
                        e.stopPropagation();
                        return false;
                    }
                }

                if (!$('#invoice_code').val()) {
                    var a = $('#invoice_code').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入纳税人识别码');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg =/^[a-zA-Z0-9]+$/;  //数字和字母
                    var invoice_code = $('#invoice_code').val();
                    if (!/^[a-zA-Z0-9]+$/.test(invoice_code)) {
                        var a = $('#invoice_code').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('识别码格式输入错误，请核对！');
                        e.stopPropagation();
                        return false;
                    }
                    var code = $.trim(invoice_code).length;
                    // console.log(code);
                    if (code !== 15 && code !== 18 && code !== 20) {
                        var a = $('#invoice_code').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('识别码格式输入错误，请核对！');
                        e.stopPropagation();
                        return false;
                    }
                }

                if (!$('#invoice_address').val()) {
                    var a = $('#invoice_address').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入详细注册地址');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg=/^(?=.*?[\u4E00-\u9FA5])/;
                    var address = $('#invoice_address').val();
                    if (!/^(?=.*?[\u4E00-\u9FA5])/.test(address)) {
                        var a = $('#invoice_address').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('注册地址不能全为数字或字母');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(address).length < 6 || $.trim(address).length > 60) {
                        var a = $('#invoice_address').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('注册地址必须为6-60个字符');
                        e.stopPropagation();
                        return false;
                    }
                }

                if (!$('#invoice_tel').val()) {
                    var a = $('#invoice_tel').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入注册电话');
                    e.stopPropagation();
                    return false;
                } else {
                    var invoice_tel = $('#invoice_tel').val();
                    if (!/^0\d{2,3}-?\d{7,8}(-\d{1,8})?$/.test(invoice_tel)) {
                        var a = $('#invoice_tel').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('注册电话格式输入错误，请核对！');
                        return false;
                    }
                    if ($.trim(invoice_tel).length < 11 || $.trim(invoice_tel).length > 20) {
                        var a = $('#invoice_address').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('注册电话格式输入错误，请核对！');
                        e.stopPropagation();
                        return false;
                    }

                }
                if (!$('#invoice_bank').val()) {
                    var a = $('#invoice_bank').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入银行名称');
                    e.stopPropagation();
                    return false;
                } else {
                    ///  ^[A-Za-z\(\)（）\x{4e00}-\x{9fa5}]+$/u
                    //  ^[A-Za-z\(\)（）\u4e00-\u9fa5]+$
                    // var reg = /^[A-Za-z\(\)（）\u4e00-\u9fa5]+$/;  //中文和字母
                    var bank = $('#invoice_bank').val();
                    if (!/^[A-Za-z\(\)（）\u4e00-\u9fa5]+$/.test(bank)) {
                        var a = $('#invoice_bank').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('银行名称格式输入错误，请核对！');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(bank).length < 6 || $.trim(bank).length > 30) {
                        var a = $('#invoice_bank').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('银行名称必须为6-30个字符');
                        e.stopPropagation();
                        return false;
                    }
                }
                if (!$('#invoice_account').val()) {
                    var a = $('#invoice_account').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入银行账户');
                    e.stopPropagation();
                    return false;
                } else {
                    var invoice_account = $('#invoice_account').val();
                    // var reg=/^[1-9][0-9]*$/;
                    //tmptxt.replace(/\D|^0/g,'')
                    if (!/^[1-9][0-9]*$/.test(invoice_account)) {
                        var a = $('#invoice_account').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('银行账户格式输入错误，请核对！');
                        e.stopPropagation();
                        return false;
                    }
                    if ($.trim(invoice_account).length < 8 || $.trim(invoice_account).length > 30) {
                        var a = $('#invoice_account').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('银行账户必须为8-30个字符');
                        e.stopPropagation();
                        return false;
                    }
                }
            }
            if ($('#zzspt_id').is(':checked')) {
                if (!$('#invoice_company_name').val()) {
                    var a = $('#invoice_company_name').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入单位名称');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg = /^[A-Za-z0-9\_\-\(\)（）\u4e00-\u9fa5]+$/;//中文，英文和数字
                    var name = $('#invoice_company_name').val();
                    var company_name = $.trim(name).length;
                    if (!/^[A-Za-z0-9\_\-\(\)（）\u4e00-\u9fa5]+$/.test(name)) {
                        var a = $('#invoice_company_name').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('单位名称请输入中英文，数字,"-","_","（）","()"的组合');
                        e.stopPropagation();
                        return false;
                    }
                    if (company_name < 3 || company_name > 60) {
                        var a = $('#invoice_company_name').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('单位名称请输入3-60个字符');
                        e.stopPropagation();
                        return false;
                    }
                }

                if (!$('#invoice_code').val()) {
                    var a = $('#invoice_code').offset().top;
                    $("html,body").animate({scrollTop: a}, 'slow');
                    layer.msg('请输入纳税人识别码');
                    e.stopPropagation();
                    return false;
                } else {
                    // var reg = /^[a-zA-Z0-9]+$/;  //数字和字母
                    var invoice_code = $('#invoice_code').val();
                    if (!/^[a-zA-Z0-9]+$/.test(invoice_code)) {
                        var a = $('#invoice_code').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('识别码格式输入错误，请核对！');
                        e.stopPropagation();
                        return false;
                    }
                    var code = $.trim(invoice_code).length;
                    // console.log(code);
                    if (code !== 15 && code !== 18 && code !== 20) {
                        var a = $('#invoice_code').offset().top;
                        $("html,body").animate({scrollTop: a}, 'slow');
                        layer.msg('识别码格式输入错误，请核对！');
                        e.stopPropagation();
                        return false;
                    }
                }
            }

            // if (!$('#demo2').attr('src')) {
            //     $('.apply-payment-box').hide();
            //     $('.apply-payment-box-frdb').show();
            //     var a = $('#demo2').offset().top;
            //     $("html,body").animate({scrollTop: a}, 'slow');
            //     layer.msg('法人身份证照片必须上传');
            //     e.stopPropagation();
            //     return false;
            // }
        })
    })
    ;

    function change_param(e) {

        // $("#province").val($("#city-picker1").data("citypicker").getValue('province'));
        // $("#city").val($("#city-picker1").data("citypicker").getValue('city'));
        // $("#district").val($("#city-picker1").data("citypicker").getValue('district'));
        //
        // $("#shipping_province").val($("#city-picker2").data("citypicker").getValue('province'));
        // $("#shipping_city").val($("#city-picker2").data("citypicker").getValue('city'));
        // $("#shipping_district").val($("#city-picker2").data("citypicker").getValue('district'));

    }
</script>

<script>
    var clock = '';
    var nums = 60;
    var btn;

    function sendCode(thisBtn) {
        var tel = $("#tel").val();
        if (!tel) {
            layer.alert('请先填写联系人手机号');
        } else {
            $.ajax({
                type: "POST",
                url: "customer/send_check_code",
                data: {tel: tel},
                dataType: "json",
                success: function (data) {
                    if (data.code == 0) {
                        btn = thisBtn;
                        btn.disabled = true; //将按钮置为不可点击
                        btn.value = nums + '秒后可重新获取';
                        clock = setInterval(doLoop, 1000); //一秒执行一次
                        return layer.alert('发送成功');
                    } else {
                        layer.alert('发送失败');
                    }
                }
            });
        }

    }

    function doLoop() {
        nums--;
        if (nums > 0) {
            btn.value = nums + '秒后可重新获取';
        } else {
            clearInterval(clock); //清除js定时器
            btn.disabled = false;
            btn.value = '点击发送验证码';
            nums = 10; //重置时间
        }
    }
</script>
</body>
</html>
